
<font size="2" face="Tahoma"><b>Nhật ký <img src="images/bl3.gif" border="0" /> Quản lý Nhật ký</b></font>
<p style="float:right">
<b>Lọc dữ liệu:</b> <input type="text" id="datepicker" class="inputbox" onchange="return edit_filter(this.value)"></p>
<hr size="1" color="#cadadd" />
<div class="function">
</div>
<div id="loading">
<center>
<form action="?act=log_list" method="post" onsubmit="return confirm('Bạn có chắc chắn không ?');">
<input type="hidden" name="func" value="del" />
<input type="hidden" name="id" value="<?=$id?>" />
<table class="tb_table" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="tb_head">
	<td>STT</td>
	<td>Tên</td>
   	<td>Loại</td>
    <td>Menu</td>
	<td>Ngày đăng</td>
	<td>Người đăng</td>
	<td>Tình trạng</td>
	<td>Người xử lý</td>
</tr>
<?php

$page		=	$page + 0;
$perpage	=	10;
$r_all		=	$db->select("fan_log","");
$sum		=	$db->num_rows($r_all);
$pages		=	($sum-($sum%$perpage))/$perpage;
if ($sum % $perpage <> 0 )	$pages = $pages+1;
$page		=	($page==0)?1:(($page>$pages)?$pages:$page);
$min 		= 	abs($page-1) * $perpage;
$max 		= 	$perpage;

$count	=	$min;
$rs	=	$db->select("fan_log","","order by time desc limit $min, $max");
while ($row = $db->fetch($rs))
{
	$count++;
?>
<tr class="tb_content">
	<td><?=$count?></td>
	<td>
	<?php
	 if($row["loai"] == 1)
	 {
		$q  = $db->select("cms","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
		?>
		<a href="?act=cms_edit&id=<?=$row['id_link']?>"><?=$row['ten']?></a>
		<?php	
		}
		else
		{
		?>
		<a href="javascript:void(0)"><?=$row['ten']?> - <b style="color:#D62719">đã xóa</b></a>
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 2)
	 {
		 $q  = $db->select("doc","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
		?>
		<a href="?act=doc_edit&id=<?=$row['id_link']?>"><?=$row['ten']?></a>
		<?php	
		}
		else
		{
		?>
		<a href="javascript:void(0)"><?=$row['ten']?> - <b style="color:#D62719">đã xóa</b></a>
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 3)
	 {
		$q  = $db->select("gallery","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
		?>
		<a href="?act=gallery_edit&id=<?=$row['id_link']?>"><?=$row['ten']?></a>
		<?php	
		}
		else
		{
		?>
		<a href="javascript:void(0)"><?=$row['ten']?> - <b style="color:#D62719">đã xóa</b></a>
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 4)
	 {
		$q  = $db->select("page","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
		?>
		<a href="?act=page_edit&id=<?=$row['id_link']?>"><?=$row['ten']?></a>
		<?php	
		}
		else
		{
		?>
		<a href="javascript:void(0)"><?=$row['ten']?> - <b style="color:#D62719">đã xóa</b></a>
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 5)
	 {
		$q  = $db->select("product","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
		?>
		<a href="?act=product_edit&id=<?=$row['id_link']?>"><?=$row['ten']?></a>
		<?php	
		}
		else
		{
		?>
		<a href="javascript:void(0)"><?=$row['ten']?> - <b style="color:#D62719">đã xóa</b></a>
		<?php	
		}
	 }
	?> 
	</td>
	<td>
	<?php
    if($row["loai"] == 1) echo "Bài viết";
	if($row["loai"] == 2) echo "File tài liệu";
	if($row["loai"] == 3) echo "Hình ảnh";
	if($row["loai"] == 4) echo "Trang nội dung";
	if($row["loai"] == 5) echo "Sản phẩm";
	?>   
    </td>
    <td>
	<?php
    if($row["loai"] == 1)
	{
		$q = $db->select("cms_menu","id = '".$row["cat"]."'");
		while($r = $db->fetch($q))
		{
			echo $r["ten"];
		}
	
	}
	if($row["loai"] == 2)
	{
		$q = $db->select("doc_menu","id = '".$row["cat"]."'");
		while($r = $db->fetch($q))
		{
			echo $r["ten"];
		}
	
	}
	if($row["loai"] == 3)
	{
		$q = $db->select("gallery_menu","id = '".$row["cat"]."'");
		while($r = $db->fetch($q))
		{
			echo $r["ten"];
		}
	
	}
	if($row["loai"] == 4)
	{
		echo "Trang nội dung";
	}
	if($row["loai"] == 5)
	{
		$q = $db->select("product_menu","id = '".$row["cat"]."'");
		while($r = $db->fetch($q))
		{
			echo $r["ten"];
		}
	
	}
	
	
	?>
    
    </td>
	<td><?=lg_date::vn_time($row["time"])?></td>
	<td>
		<?php
	if($row["user"] == 0)
	{
		echo "-";
	}
	else
	{
	?>
	<a href="?act=member_edit&id=<?=$row["user"]?>"><?=get_user($row["user"],"username")?></a>
	<?php
	}
	?>	
	</td>
	<td>
	<?php
	 if($row["loai"] == 1)
	 {
		$q  = $db->select("cms","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
			while($r = $db->fetch($q))
			{
				if($r["hien_thi"] == 1)
				{
					echo "Đã xử lý";
				}
				else
				{
				?>
				<b style="color:#D62719">Chờ xử lý</b>
				<?php
				}
			}	
		}
		else
		{
		?>
		-
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 2)
	 {
		 $q  = $db->select("doc","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
			while($r = $db->fetch($q))
			{
				if($r["hien_thi"] == 1)
				{
					echo "Đã xử lý";
				}
				else
				{
				?>
				<b style="color:#D62719">Chờ xử lý</b>
				<?php
				}
			}	
		}
		else
		{
		?>
		-
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 3)
	 {
		$q  = $db->select("gallery","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
			while($r = $db->fetch($q))
			{
				if($r["hien_thi"] == 1)
				{
					echo "Đã xử lý";
				}
				else
				{
				?>
				<b style="color:#D62719">Chờ xử lý</b>
				<?php
				}
			}	
		}
		else
		{
		?>
		-
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 4)
	 {
		$q  = $db->select("page","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
			while($r = $db->fetch($q))
			{
				if($r["hien_thi"] == 1)
				{
					echo "Đã xử lý";
				}
				else
				{
				?>
				<b style="color:#D62719">Chờ xử lý</b>
				<?php
				}
			}	
		}
		else
		{
		?>
		-
		<?php	
		}
	 }
	?>
	<?php
	 if($row["loai"] == 5)
	 {
		$q  = $db->select("product","id = '".$row["id_link"]."'");
		if($db->num_rows($q) !=0)
		{
			while($r = $db->fetch($q))
			{
				if($r["hien_thi"] == 1)
				{
					echo "Đã xử lý";
				}
				else
				{
				?>
				<b style="color:#D62719">Chờ xử lý</b>
				<?php
				}
			}	
		}
		else
		{
		?>
		-
		<?php	
		}
	 }
	?> 
	</td>
	<td>
	<?php
	if($row["user_approve"] == 0)
	{
		echo "-";
	}
	else
	{
	?>
	<a href="?act=member_edit&id=<?=$row["user_approve"]?>"><?=get_user($row["user_approve"],"username")?></a>
	<?php
	}
	?>	
	</td>
</tr>
<?
}
?>
<tr class="tb_foot">
	<td colspan="7" style="text-align:left;">
		<strong>Trang : </strong>
		<?php
			if ($pages==0) echo ":1:";
    		for($i=1;$i<=$pages;$i++) {
    			if ($i==$page) echo "<b>[".$i."]</b>";
    			else {
					echo "<a href='?act=log_list&id=".$id."&page=$i'>-$i-</a>";
				}
			}
    	?>
	</td>
	<td>  
    </td>
</tr>
</table>
</table>
</form>
</center>
</div>
<div class="function">
</div>
